package com.example.tang.zhayan.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.tang.zhayan.R;

import java.util.List;

/**
 * Created by tang on 2015/12/14.
 * PopupWindow的弹出框的数据加载
 */
public class PopupwindowAdapter extends BaseAbstractAdapter<String> {

    public PopupwindowAdapter(Context context, List list) {
        super(context, list);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        if (holder == null) {
            convertView = inflater.inflate(R.layout.popupwindow_listview_item, null);
            holder = new ViewHolder(convertView);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.textView.setText(list.get(position));
        return convertView;
    }

    class ViewHolder {
        TextView textView;
        public ViewHolder(View converView) {
            textView = (TextView) converView.findViewById(R.id.tv_popupwindow_text);
        }

    }
}
